package crivia.eca.carry;

import java.util.ArrayList;
import java.util.List;

import crivia.db.a.DataSet_AC;

import weaver.conn.RecordSet;
import weaver.conn.RecordSetDataSource;
import weaver.conn.RecordSetTrans;
import weaver.soa.workflow.request.Cell;
import weaver.soa.workflow.request.DetailTable;
import weaver.soa.workflow.request.Row;

public class DataSet_Ecology_Column extends DataSet_AC {
	
	public DataSet_Ecology_Column(RecordSet tRS, List<String> keys){
		for (String s : keys){
			rawKeys.add(s);
			String key = s.toLowerCase();
			datas.put(key, new ArrayList<String>());
		}
		while (tRS.next()){
			for (String k : keys){
				addValue(k, tRS.getString(k));
			}
		}
	}
	
	public DataSet_Ecology_Column(RecordSet tRS, String... keys){
		for (String s : keys){
			rawKeys.add(s);
			String key = s.toLowerCase();
			datas.put(key, new ArrayList<String>());
		}
		while (tRS.next()){
			for (String k : keys){
				addValue(k, tRS.getString(k));
			}
		}
	}
	
	public DataSet_Ecology_Column(RecordSetTrans tRS, String... keys){
		for (String s : keys){
			rawKeys.add(s);
			String key = s.toLowerCase();
			datas.put(key, new ArrayList<String>());
		}
		while (tRS.next()){
			for (String k : keys){
				addValue(k, tRS.getString(k));
			}
		}
	}
	
	public DataSet_Ecology_Column(DetailTable subTable){
		for (Row row : subTable.getRow()){
			addValue("id", row.getId());
			for (Cell cell : row.getCell()){
				rawKeys.add(cell.getName());
				addValue(cell.getName(), cell.getValue());
			}
		}
	}

	public DataSet_Ecology_Column(RecordSetDataSource tRS,List<String> keys){
		for (String s : keys){
			rawKeys.add(s);
			String key = s.toLowerCase();
			datas.put(key, new ArrayList<String>());
		}
		while (tRS.next()){
			for (String k : keys){
				addValue(k, tRS.getString(k));
			}
		}
	}

	public DataSet_Ecology_Column(RecordSetDataSource tRS, String... keys) {
		for (String s : keys){
			rawKeys.add(s);
			String key = s.toLowerCase();
			datas.put(key, new ArrayList<String>());
		}
		while (tRS.next()){
			for (String k : keys){
				addValue(k, tRS.getString(k));
			}
		}
	}

}
